package com.sinosoft;

import java.sql.Date;

/**
 * @Author: WangShengJie
 * @Date: 2025/2/25
 */
public class AddressDemo {
    public static void main(String[] args) {
//        String m_address = "110000@110100@110101@15151@双井乐成中心2704室";
//////        String[] split = address.split("@");
//////        System.out.println(split.length);
////        StringBuffer stringBuffer = new StringBuffer(address);
////        //安全起见，还是需要加一个
//////        stringBuffer.insert(address.lastIndexOf("@"), "@");
////        System.out.println(stringBuffer.toString());
////        String[] split = stringBuffer.toString().split("@");
////        System.out.println(split[0]);       //110000    Address_1
////        System.out.println(split[1]);       //110100    Address_2
////        System.out.println(split[2]);       //110101    Address_4
////        System.out.println(split[3]);       //""        Address_5
//////        System.out.println(split[4]);       //双井乐成中心2704室   Address_3
//
//        //获取城镇/街道中间字串
//        int lastIndexOf = m_address.lastIndexOf("@");
//        int startIndexOf = m_address.substring(0, lastIndexOf).toString().lastIndexOf("@");
//        System.out.println("lastIndexOf="+lastIndexOf+";  startIndexOf="+startIndexOf);
//        System.out.println("*********************");
//        System.out.println(m_address);
//        String substring = m_address.substring(startIndexOf, lastIndexOf);
//        System.out.println(substring);
//        System.out.println("*********************");
////        m_address = m_address.replace(substring, "");
//        StringBuffer stringBuffer = new StringBuffer(m_address);
//        m_address= stringBuffer.delete(startIndexOf, lastIndexOf).toString();
//        System.out.println(m_address);
//
//        String date = "2025-03-03 15:01";
//        Date date1 = Date.valueOf("");
//        System.out.println(date1);
        ;
        System.out.println(toDbc(" 四川省成都市锦江区中山市古镇镇古二村麒麟里直冲"));
    }

    public static String toDbc(String input) {
        if (org.apache.commons.lang3.StringUtils.isBlank(input)) {
            return "";
        }
        input = input.trim();
        char[] c = input.toCharArray();
        for (int i = 0; i < c.length; i++) {
            if (c[i] == 12288) {
                c[i] = (char) 32;
                continue;
            }
            if (c[i] > 65280 && c[i] < 65375) {
                c[i] = (char) (c[i] - 65248);
            }
        }
        return new String(c);
    }
}
